#ifndef __BONUSBINGOGAME_H__
#define __BONUSBINGOGAME_H__

//#define DEBUG_KNOWNSPINS

#include "lib.h"
#include "BonusBingoConstants.h"
#include "WeightedOutcomes.h"

class BonusBingoCard;
class BonusBingoGameResult;

class BonusBingoGame  
{
public:
	BonusBingoGame(int32 bet);
	BonusBingoGame(int32 bet, uint8 restoredMultiplierValue);

	virtual ~BonusBingoGame();

    BonusBingoCard* getCard(int8 index) const;

    int32 addCard(int8 index, BonusBingoCard* const card);

    void clearCards();

    void multiplyCard( int8 index );

    void clearMultiplier();

    bool8 winsMultiplier();

    uint8 getMultiplierValue() const;

    int8 getMultipliedCardIndex() const;
    
    int32 getMultipliedCardID() const;

    void setMultipliedCardIndex(int8 index);

    void setMultipliedCardID(int32 id);

    bool8 isValid() const;

    BonusBingoGameResult* play();

	uint8	getCardsPlayed() const;

	int32	getPerCardBet() const;

    int32   getBetForCard( int32 cardIndex ) const;

	int32	getTotalBet() const;

	int32	getJokerWinValue() const;

protected:		//Data
    static const int32  g_SpecialBallInverseProb;

    int32	m_betAmount;

	int32   m_jokerWinValue;

    uint8	m_multiplierValue;

    int8	m_multipliedCardIndex;

    BonusBingoCard*   m_cards[BonusBingo::NUM_MAX_CARDS];

protected:
    void setMultiplierValue();

	void setJokerWinValue();

    static WeightedOutcomes MultiplierOutcomes;

    static void LoadMultiplierOutcomes();

    static WeightedOutcomes JokerOutcomes;

    static void LoadJokerOutcomes();

    //I like integer math
    enum MultiplierProbability
    {
        WIN_THREE =   2,
        WIN_TWO   =   WIN_THREE +   5,
        WIN_ONE   =   WIN_TWO   +   106,
        MULTIPLIER_BASE      =   WIN_ONE
    };

    enum JokerProbability
    {
        WIN_FIFTY         =   100,
        WIN_TWENTY_FIVE   =   WIN_FIFTY       + 200,
        WIN_TEN           =   WIN_TWENTY_FIVE + 400,
        WIN_SEVEN         =   WIN_TEN         + 700,
        WIN_FIVE          =   WIN_SEVEN       + 1000,
        WIN_FOUR          =   WIN_FIVE        + 7600,
        JOKER_BASE        =   WIN_FOUR
    };
};


#endif //__BONUSBINGOGAME_H__